package com.ss.android.newmedia.j;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import com.ss.android.common.AbsApiThread;
import com.ss.android.common.util.NetworkUtils;

public final class d extends AbsApiThread {
    private final Context a;
    private final Handler b;
    private final String c;

    public d(Context arg1, Handler arg2, String arg3) {
        this.a = arg1;
        this.b = arg2;
        this.c = arg3;
    }

    private void a(int arg3, int arg4, Object arg5) {
        Message v0 = this.b.obtainMessage(arg3);
        if (arg4 != 0) {
            v0.arg1 = arg4;
        }

        if (arg5 != null) {
            v0.obj = arg5;
        }

        this.b.sendMessage(v0);
    }

    public final void run() {
        String v0_2;
        int v5 = 17;
        Object v4 = null;
        int v3 = 107;
        if (android.support.design.a.isTextEmpty(this.c)) {
            this.a(v3, v5, v4);
            return;
        }

        try {
            if (NetworkUtils.isNetworkAvailable(this.a)) {
                StringBuilder v0_1 = new StringBuilder();
                v0_1.append(this.c);
                v0_2 = NetworkUtils.doGet(-1, v0_1.toString());
                if (!android.support.design.a.isTextEmpty(v0_2)) {
                    int v1 = 106;
                    this.a(v1, 0, v0_2);
                    return;
                }
                this.a(107, 17, null);
                return;
            }

            this.a(107, 12, null);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            this.a(v3, v5, v4);
        }
    }
}

